using System;
using System.Collections.Generic;
using System.Text;

using Raxxla.DayBreak.Core.Collections;

namespace Raxxla.DayBreak.Core
{
    /// <summary>
    /// Device driven object base class
    /// </summary>
    public abstract class DeviceDrivenObject : UniqueObject
    {
        public static readonly ObjectMap<DeviceDrivenObject> Instances = new ObjectMap<DeviceDrivenObject>();
        public static event DDObjectDelegate OnObjectCreated;

        public DeviceDrivenObject()
        {
            ObjectCreated();
        }

        protected void ObjectCreated()
        {
            int id = Instances.Add(this);
            this._uniqueKey = id;

            if (OnObjectCreated != null)
                OnObjectCreated(this);
        }
    }

    /// <summary>
    /// Delegate with DDObject argument
    /// </summary>
    /// <param name="obj"></param>
    public delegate void DDObjectDelegate(DeviceDrivenObject obj);

}
